package com.anlgin.anl_tea.service.impl;

import com.anlgin.anl_tea.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.anlgin.anl_tea.entities.Commodity;
import com.anlgin.anl_tea.entities.Order;
import com.anlgin.anl_tea.mapper.OrderMapper;

import java.util.List;

@Service
@Transactional
public class OrderServiceImpl implements IOrderService {


    private OrderMapper orderMapper;

    @Autowired
    public OrderServiceImpl(OrderMapper orderMapper) {
        this.orderMapper = orderMapper;
    }

    @Override
    public void insertOrder(Order order) {
        orderMapper.insertOrder(order);
    }

    @Override
    public void insertOrderCommodity(Commodity commodity) {
        orderMapper.insertOrderCommodity(commodity);
    }

    @Override
    public List<Order> getOrderByState(Order order) {
        return orderMapper.getOrderByState(order);
    }

    @Override
    public List<Commodity> getCommodityByOrder(Order order) {
        return orderMapper.getCommodityByOrder(order);
    }

    @Override
    public List<Order> getHistoryOrder(Order order) {
        return orderMapper.getHistoryOrder(order);
    }

    @Override
    public List<Order> getCurrentOrder() {
        return orderMapper.getCurrentOrder();
    }

    @Override
    public List<Order> getCancelOrder() {
        return orderMapper.getCancelOrder();
    }

    @Override
    public List<Order> getFinishOrder() {
        return orderMapper.getFinishOrder();
    }

    @Override
    public List<Order> getWaitPayOrder() {
        return orderMapper.getWaitPayOrder();
    }

    @Override
    public void changeOrderToComplate(Order order) {
        orderMapper.changeOrderToComplate(order);
    }
}
